<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="./bank.js"></script>
    <script>
        function myAjax(type = 'GET', url, params, callback) {
            let xmlHttp;
            xmlHttp = new XMLHttpRequest();
            if (type === 'GET') {
                xmlHttp.open(type, url, true);
                xmlHttp.send(null);
            } else if (type === 'POST') {
                xmlHttp.open(type, url);
                xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                xmlHttp.send(params)
            }
            xmlHttp.onreadystatechange = function () {
                if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
                    callback(xmlHttp.responseText)
                }
            }
        }
        function aaa(cardNo) {
            for (let i = 0; i < BANK_CARD_LIST.length; i++) {
                const BANK_CARD_PATTERNS = BANK_CARD_LIST[i].patterns;
                for (let j = 0; j < BANK_CARD_PATTERNS.length; j++) {
                    let flag = BANK_CARD_PATTERNS[j].reg.test(cardNo);
                    if (flag) {
                        let result = {
                            bankName: BANK_CARD_LIST[i].bankName,
                            cardNo: cardNo,
                            bankCode: BANK_CARD_LIST[i].bankCode,
                            cardType: BANK_CARD_PATTERNS[j].cardType,
                        }
                        BANK_CARD_PATTERNS[j].reg.lastIndex = 0;
                        return result;
                    }
                }
            }
            return false;
        }
        let c1 = '6215582308000644667';
        let c2 = '6225767777255464';
        let c3 = '6214832813213365';
        let c4 = '6230520460243084872'
        myAjax('GET', `https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?cardNo=${c4}&cardBinCheck=true`, { },data=>{
            console.log(data);
        })
    </script>
</body>

</html>